﻿using System;
using System.Windows;
using System.Windows.Data;
using YKXiangQi.Enums;

namespace YKXiangQi.Converters
{
    public class ViewModeVisibilityConverter: IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var viewMode = (ViewMode) value;
            var param = parameter.ToString();

            if(param == "grid")
            {
                if (viewMode == ViewMode.Visible || viewMode == ViewMode.Hidden)
                    return Visibility.Visible;
                
                return Visibility.Collapsed;
            }
            else
            {
                if (viewMode == ViewMode.Visible)
                    return Visibility.Collapsed;
                return Visibility.Visible;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
